// components/sj-scrollview.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    scrollanswer: {
      type: Object,
      observer: function (oldVal, newVal) {
        console.log(oldVal, newVal);
      }
    },
    index: {
      type: Number,
      value: 1
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    toView: 'green',
    id: null,
    background: {
      color: "#42a5f5"
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    ansew(e) {

console.log(e);
      let {
        scrollanswer
      } = this.properties;
      let list = []
      list = scrollanswer.answerList.map(item => {

        return { 
          ...item,
          checked: false
        }

      })

      this.setData({
        id: e.currentTarget.dataset.item.id,
        scrollanswer: Object.assign({
          ...scrollanswer,
          answerList: list
        })
      })

      this.triggerEvent('change', e.currentTarget.dataset.item);
    },




  }
})